<?php
/*******************************************************************************

	/assets/classes/airAuth.ps

	author: scumyang@gmail.com
	create: 2016-12-12
	update:

*******************************************************************************/

//------------------------------------------------------------------------------
// SWA 子类
//------------------------------------------------------------------------------
class airAuth extends WebRester_Action implements I_WebRester_Action
{
	function __construct( $__opt=null )
	{
	}

	public function onRequest( $__req, $__resp )
	{
		sendJson( '{success:0,responseMsg:"未映射的请求: ' . $_SERVER['REQUEST_URI']. '"}' );
		//echo "class=" . get_class($this);
		//CUtils::var_dump( $__req );
		//$this->loadTemplate( 'home/index.ps' );
	}

	public function version( $__req, $__resp )
	{
		sendJson( '{"success":"1","responseJSON":{"version":"airAuth [WiFiDog] v1.0.0.1"}}' );
	}
	
	public function depCheck( $__req, $__resp )
	{
		global $classFinder;
		$classFinder->exec( 'airAuth', 'depCheck', $__req, SEND_RESPONSE | END_RESPONSE );
	}
	
	public function testCase( $__req, $__resp )
	{
		global $classFinder;
		$classFinder->exec( 'airAuth', 'testCase', $__req, SEND_RESPONSE | END_RESPONSE );
	}
	
	public function bsn( $__req, $__resp )
	{
		global $classFinder;
		sendJson( '{"success":"1","responseJSON":{"bsn":"' . CUtils::newGUID( '', 9999 ) . '"}}' );
	}

	public function login( $__req, $__resp )
	{
		global $classFinder;
		$classFinder->exec( 'airAuth', 'login', $__req, SEND_RESPONSE | END_RESPONSE );
	}

	public function auth( $__req, $__resp )
	{
		global $classFinder;
		$classFinder->exec( 'airAuth', 'auth', $__req, SEND_RESPONSE | END_RESPONSE );
	}

	public function ping( $__req, $__resp )
	{
		global $classFinder;
		$classFinder->exec( 'airAuth', 'ping', $__req, SEND_RESPONSE | END_RESPONSE );
	}

	public function portal( $__req, $__resp )
	{
		global $classFinder;
		$classFinder->exec( 'airAuth', 'portal', $__req, SEND_RESPONSE | END_RESPONSE );
	}

	public function getCaptcha( $__req, $__resp )
	{
		global $classFinder;
		$type = $__req->attr('type');

		switch( $type )
		{
			default:
			case 'sms': $classFinder->exec( 'airAuth', 'getSmsCaptcha', $__req, SEND_RESPONSE | END_RESPONSE ); break;

			case 'image': $classFinder->exec( 'airAuth', 'getImageCaptcha', $__req, SEND_RESPONSE | END_RESPONSE ); break;
		}

	}

}

?>
